# 指定 cmake 最低版本
cmake_minimum_required(VERSION 3.20)

# 项目
project("cmake_include")

message("begin include")

# 引入cmake文件 -- 相当于将文件内容直接拷贝于此
include("cmake/test_cmake.cmake")
include("cmake/test_cmake.cmake")
# include("cmake/test_cmake1.cmake") # 引入不存在的文件直接报错
include("cmake/test_cmake1.cmake" OPTIONAL) # OPTIONAL 可选，文件不存在不报错

# 返回值 ret，表明是否引入成功
include("cmake/test_cmake1.cmake" OPTIONAL RESULT_VARIABLE ret) 
message("RESULT_VARIABLE ret = ${ret}") # NOTFOUND

# 返回值 ret，表明是否引入成功
include("cmake/test_cmake.cmake" OPTIONAL RESULT_VARIABLE ret) 
message("RESULT_VARIABLE ret = ${ret}") # cmake文件的路径

message("end include")

